package com.hyt.it.ogt.kq.service.bm.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hyt.it.ogt.kq.service.bm.model.entity.StudentInfo;
import com.hyt.it.ogt.kq.service.bm.model.vo.*;
import com.hyt.model.PageParam;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Optional;
import java.util.Set;

/**
 * <p>
 * 考生基础信息 Mapper 接口
 * </p>
 *
 * @author wangt
 * @since 2020-05-15
 */

public interface StudentInfoMapper extends BaseMapper<StudentInfo> {

    int saveList(@Param("lists") List<StudentInfo> list);

    List<StudentInfoVo> getByStudentId(@Param("projectId") String projectId, @Param("studentId") String studentId,
                                       @Param("isAudit") String isAudit);

    List<StudentVo> queryStudentList(StudentParam studentParam, @Param("permissionList") List<String> permissionList, long current, long size);

    long queryStudentListCount(StudentParam studentParam, @Param("permissionList") List<String> permissionList);

    void updateKwFlag(@Param("projectId") String enrollId, @Param("subjectId") String subjectId,
                      @Param("ids") List<String> studentIds);

    IPage<StudentInfoDeatailVo> getPageStudent(PageParam<StudentInfoDeatailVo> pageParam,
                                               @Param("projectId") String enrollId, @Param("subjectId") String subjectId,
                                               @Param("queryStr") String queryStr, @Param("auditState") String auditState,
                                               @Param("payState") String payState);

    StudentVo getStuInfoByStudentId(@Param("projectId") String projectId, @Param("studentId") String studentId);

    Integer getAuditByStudentId(@Param("studentId") String studentId);

    StudentInfo getStudentByCollectId(@Param("collectId") String collectId, @Param("studentId") String studentId,
                                      @Param("projectId") String projectId);


    StudentInfo getStuByCollectId(@Param("collectId") String collectId, @Param("projectId") String projectId,
                                  @Param("value") String value);

    List<StudentInfo> getByProjectId(@Param("projectId") String projectId);

    void updateSubjectKwFlag(@Param("projectId") String projectId, @Param("subjectId") String subjectId);

    List<UserPermissionStatVo> statProjectStudent(@Param("deptIds") Set<String> deptIds, @Param("startTime") String startTime, @Param("endTime") String endTime);

    List<UserPermissionStatVo> statOfficeProjectStudent(@Param("deptIds") Set<String> deptIds, @Param("startTime") String startTime, @Param("endTime") String endTime);

    /**
     * 获取区域绑定的考生数量
     *
     * @param projectId
     * @param collectInfoId
     * @return
     */
    List<UserPermissionStatVo> getAreaProjectStudentNum(@Param("projectId") String projectId, @Param("collectInfoId") String collectInfoId);

    /**
     * 非区域的报名考生数
     *
     * @param projectId
     * @return
     */
    Optional<UserPermissionStatVo> getNonAreaProjectStudentNum(@Param("projectId") String projectId, @Param("deptId") String deptId);

    /**
     * 获取所有的考生信息
     *
     * @param projectId 报名ID
     * @param isPay     是否支付
     * @param isAudit   是否审核
     * @param current   当前页
     * @param size      页大小
     * @return
     */
    List<StudentInfo> queryAllStudentInfo(@Param("projectId") String projectId,
                                          @Param("isPay") String isPay,
                                          @Param("isAudit") String isAudit,
                                          @Param("current") int current,
                                          @Param("size") int size);

    /**
     * 查询未报考科目的考生名单
     * @param projectId
     */
    List<String> getNoSubjectStudentIds(@Param("projectId") String projectId);
}
